<template>
	<view>
		<view class="bg-white flex-col align-center">
			
		</view>
		
		<view class="bg-white">
			<u-field v-model="form.name" label="甲方名称" label-width="160" input-align="right" :clearable="false" placeholder="请输入公司名称">
			</u-field>
			<u-field v-model="form.mobile" label="联系电话" label-width="160" input-align="right" :clearable="false" placeholder="请输入联系电话">
			</u-field>
			<u-field v-model="form.address" label="联系地址" label-width="160" input-align="right" :clearable="false" placeholder="请输入联系地址">
			</u-field>
		</view>

		<my-btn gold style="margin: 60rpx auto;" @click="submit">提交</my-btn>
		<view class="padding-lr-lg text-yellow">
			注：合同一经生成不可修改！请务必确认填写的信息是否正确，避免带来不必要的麻烦。
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				no: '',
				form: {
					name: '',
					mobile: '',
					address: '',
					trade_no: ''
				}
			};
		},
		onLoad(opt) {
			this.no = opt.no
			this.form.trade_no = opt.no
			this.getData()
		},
		methods: {
			submit() {
				this.$u.post('/order/contract', this.form).then(res => {
					this.$msg(res.data.msg, 1000, true).then(res => {
						this.$goto(1)
					})
				})
			},
			getData() {
				uni.showLoading({
					title: '请稍等',
					mask: true
				})
				this.$u.get('/order/contract/info?trade_no='+this.no).then(res => {
					let info = res.data.result.contract
					this.form.name = info.name
					this.form.mobile = info.mobile
					this.form.address = info.address
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
